package org.raymond.iworks.apis;

import org.raymond.iworks.apis.common.Result;
import org.raymond.iworks.apis.fallbackFactory.ITSysPermissionServiceFallbackFactory;
import org.raymond.iworks.apis.vo.permission.PermissionInfoVO;
import org.raymond.iworks.apis.vo.permission.PermissionNodeVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author raymond
 * @version V1.0
 */
//@Resource(name="permission")
@FeignClient(name="admin", contextId="permission",
        fallbackFactory= ITSysPermissionServiceFallbackFactory.class
)
public interface ITSysPermissionServiceApi {
    //@Resource(name="permission:edit")
    @PostMapping("/permission/refresh")
    Result<Boolean> refresh();

    @PostMapping("/permission/update")
    Result<PermissionInfoVO> update(@RequestBody PermissionInfoVO vo);

    @PostMapping("/permission/delete")
    Result<Boolean> delete(@RequestBody PermissionInfoVO vo);

    //@Resource(name="permission:query")
    @GetMapping("/permission/list")
    Result<List<PermissionInfoVO>> list(PermissionInfoVO vo);

    //@Resource(name="permission:query")
    @GetMapping("/permission/getTreeByRoleId")
    Result<PermissionNodeVO> getTreeByRoleId(@RequestParam(value="id", required=true) Long id);

    //@Resource(name="permission:query")
    @GetMapping("/permission/tree")
    Result<PermissionInfoVO> tree();
}
